﻿using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Rest.WebApiClient.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WebApiClient;

namespace Rest.API.Service1
{
    public class JITHttpsModule
    {
        public static IServiceCollection Register(IServiceCollection services, IConfigurationRoot appConfiguration)
        {
            services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();

            //void config(HttpApiConfig c)
            //{
            //    c.HttpHost = new Uri(appConfiguration["Server:Url"]);//AppSettings.json 中的服务器地址
            //    c.GlobalFilters.Add(new DefaultHeaderAttribute(appConfiguration));
            //}

            //services.AddHttpApi<IUserApi>().ConfigureHttpApiConfig(config);//注入接口

            return services;
        }
    }
}
